/*********************************************************************
	Rhapsody	: 8.0
	Login		: Andrzej
	Component	: DefaultComponent
	Configuration 	: DefaultConfig
	Model Element	: TemperatureMeasurer
//!	Generated Date	: Fri, 14, Dec 2012 
	File Path	: DefaultComponent/DefaultConfig/Default/TemperatureMeasurer.java
*********************************************************************/

package Default;

//## auto_generated
import java.util.*;
//## auto_generated
import com.ibm.rational.rhapsody.oxf.*;
//## auto_generated
import com.ibm.rational.rhapsody.oxf.states.*;

//----------------------------------------------------------------------------
// Default/TemperatureMeasurer.java                                                                  
//----------------------------------------------------------------------------

//## package Default 


//## class TemperatureMeasurer 
public class TemperatureMeasurer implements RiJStateConcept {
    
    public Reactive reactive;		//## ignore 
    
    protected double avgTemp = 27;		//## attribute avgTemp 
    
    protected boolean isBroken = false;		//## attribute isBroken 
    
    protected java.util.HashMap<Probe, Double> temperatures = new java.util.HashMap<Probe, Double>();		//## attribute temperatures 
    
    protected ArrayList<Probe> itsProbe = itsProbe = new ArrayList<Probe>();		//## classInstance itsProbe 
    
    protected DecisionMaker parent;		//## link parent 
    
    //#[ ignore 
    public static final int RiJNonState=0;
    public static final int Workflow=1;
    public static final int state_9=2;
    public static final int terminationstate_16=3;
    public static final int CheckForMalfunction=4;
    public static final int state_2=5;
    public static final int terminationstate_14=6;
    public static final int AwaitBreakdown=7;
    public static final int state_10=8;
    public static final int sendaction_12=9;
    public static final int AwaitTemperatureChanges=10;
    public static final int state_1=11;
    public static final int AwaitNewProbes=12;
    public static final int sendaction_4=13;
    //#]
    protected int rootState_subState;		//## ignore 
    
    protected int rootState_active;		//## ignore 
    
    protected int state_9_subState;		//## ignore 
    
    protected int state_9_active;		//## ignore 
    
    protected int state_2_subState;		//## ignore 
    
    protected int state_2_active;		//## ignore 
    
    protected int state_10_subState;		//## ignore 
    
    protected int state_10_active;		//## ignore 
    
    protected int state_1_subState;		//## ignore 
    
    protected int state_1_active;		//## ignore 
    
    
    //## statechart_method 
    public RiJThread getThread() {
        return reactive.getThread();
    }
    
    //## statechart_method 
    public void schedTimeout(long delay, long tmID, RiJStateReactive reactive) {
        getThread().schedTimeout(delay, tmID, reactive);
    }
    
    //## statechart_method 
    public void unschedTimeout(long tmID, RiJStateReactive reactive) {
        getThread().unschedTimeout(tmID, reactive);
    }
    
    //## statechart_method 
    public boolean isIn(int state) {
        return reactive.isIn(state);
    }
    
    //## statechart_method 
    public boolean isCompleted(int state) {
        return reactive.isCompleted(state);
    }
    
    //## statechart_method 
    public RiJEventConsumer getEventConsumer() {
        return (RiJEventConsumer)reactive;
    }
    
    //## statechart_method 
    public void gen(RiJEvent event) {
        reactive._gen(event);
    }
    
    //## statechart_method 
    public void queueEvent(RiJEvent event) {
        reactive.queueEvent(event);
    }
    
    //## statechart_method 
    public int takeEvent(RiJEvent event) {
        return reactive.takeEvent(event);
    }
    
    // Constructors
    
    //## auto_generated 
    public  TemperatureMeasurer(RiJThread p_thread) {
        reactive = new Reactive(p_thread);
        initRelations(p_thread);
    }
    
    //## auto_generated 
    public double getAvgTemp() {
        return avgTemp;
    }
    
    //## auto_generated 
    public void setAvgTemp(double p_avgTemp) {
        avgTemp = p_avgTemp;
    }
    
    //## auto_generated 
    public boolean getIsBroken() {
        return isBroken;
    }
    
    //## auto_generated 
    public void setIsBroken(boolean p_isBroken) {
        isBroken = p_isBroken;
    }
    
    //## auto_generated 
    public java.util.HashMap<Probe, Double> getTemperatures() {
        return temperatures;
    }
    
    //## auto_generated 
    public void setTemperatures(java.util.HashMap<Probe, Double> p_temperatures) {
        temperatures = p_temperatures;
    }
    
    //## auto_generated 
    public ListIterator<Probe> getItsProbe() {
        ListIterator<Probe> iter = itsProbe.listIterator();
        return iter;
    }
    
    //## auto_generated 
    public void _addItsProbe(Probe p_Probe) {
        itsProbe.add(p_Probe);
    }
    
    //## auto_generated 
    public Probe newItsProbe() {
        Probe newProbe = new Probe(getThread());
        newProbe._setParent(this);
        itsProbe.add(newProbe);
        return newProbe;
    }
    
    //## auto_generated 
    public void _removeItsProbe(Probe p_Probe) {
        itsProbe.remove(p_Probe);
    }
    
    //## auto_generated 
    public void deleteItsProbe(Probe p_Probe) {
        p_Probe._setParent(null);
        itsProbe.remove(p_Probe);
        p_Probe=null;
    }
    
    //## auto_generated 
    public DecisionMaker getParent() {
        return parent;
    }
    
    //## auto_generated 
    public void __setParent(DecisionMaker p_DecisionMaker) {
        parent = p_DecisionMaker;
    }
    
    //## auto_generated 
    public void _setParent(DecisionMaker p_DecisionMaker) {
        if(parent != null)
            {
                parent.__setItsTemperatureMeasurer(null);
            }
        __setParent(p_DecisionMaker);
    }
    
    //## auto_generated 
    public void setParent(DecisionMaker p_DecisionMaker) {
        if(p_DecisionMaker != null)
            {
                p_DecisionMaker._setItsTemperatureMeasurer(this);
            }
        _setParent(p_DecisionMaker);
    }
    
    //## auto_generated 
    public void _clearParent() {
        parent = null;
    }
    
    //## auto_generated 
    protected void initRelations(RiJThread p_thread) {
        {
            for (int i = 0; i < 5; i++) 
                newItsProbe();
            
        }
    }
    
    //## auto_generated 
    public boolean startBehavior() {
        boolean done = true;
        {
            ListIterator<Probe> iter = itsProbe.listIterator();
            while (iter.hasNext()){
                done &= (itsProbe.get(iter.nextIndex())).startBehavior();
                iter.next();
            }
        }
        done &= reactive.startBehavior();
        return done;
    }
    
    //## ignore 
    public class Reactive extends RiJStateReactive {
        
        // Default constructor 
        public Reactive() {
            this(RiJMainThread.instance());
        }
        
        
        // Constructors
        
        public  Reactive(RiJThread p_thread) {
            super(p_thread);
            initStatechart();
        }
        
        //## statechart_method 
        public boolean isIn(int state) {
            if(state_1 == state)
                {
                    return isIn(Workflow);
                }
            if(state_1_subState == state)
                {
                    return true;
                }
            if(state_10 == state)
                {
                    return isIn(Workflow);
                }
            if(state_10_subState == state)
                {
                    return true;
                }
            if(state_2 == state)
                {
                    return isIn(Workflow);
                }
            if(state_2_subState == state)
                {
                    return true;
                }
            if(state_9 == state)
                {
                    return isIn(Workflow);
                }
            if(state_9_subState == state)
                {
                    return true;
                }
            if(rootState_subState == state)
                {
                    return true;
                }
            return false;
        }
        
        //## statechart_method 
        public boolean isCompleted(int state) {
            if(state_2 == state)
                {
                    return ( isIn(terminationstate_14) );
                }
            if(state_9 == state)
                {
                    return ( isIn(terminationstate_16) );
                }
            if(Workflow == state)
                {
                    if(isCompleted(state_9) == false)
                        {
                            return false;
                        }
                    if(isCompleted(state_2) == false)
                        {
                            return false;
                        }
                    return true;
                }
            return true;
        }
        
        //## statechart_method 
        public void rootState_entDef() {
            {
                rootState_enter();
                rootStateEntDef();
            }
        }
        
        //## statechart_method 
        public int rootState_dispatchEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            switch (rootState_active) {
                case Workflow:
                {
                    res = Workflow_dispatchEvent(id);
                }
                break;
                case sendaction_4:
                {
                    res = sendaction_4_takeEvent(id);
                }
                break;
                default:
                    break;
            }
            return res;
        }
        
        //## statechart_method 
        public int Workflow_dispatchEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(state_1_dispatchEvent(id) >= 0)
                {
                    res = RiJStateReactive.TAKE_EVENT_COMPLETE;
                    if(!isIn(Workflow))
                        {
                            return res;
                        }
                }
            if(state_2_dispatchEvent(id) >= 0)
                {
                    res = RiJStateReactive.TAKE_EVENT_COMPLETE;
                    if(!isIn(Workflow))
                        {
                            return res;
                        }
                }
            if(state_9_dispatchEvent(id) >= 0)
                {
                    res = RiJStateReactive.TAKE_EVENT_COMPLETE;
                    if(!isIn(Workflow))
                        {
                            return res;
                        }
                }
            if(state_10_dispatchEvent(id) >= 0)
                {
                    res = RiJStateReactive.TAKE_EVENT_COMPLETE;
                    if(!isIn(Workflow))
                        {
                            return res;
                        }
                }
            if(res == RiJStateReactive.TAKE_EVENT_NOT_CONSUMED)
                {
                    res = Workflow_takeEvent(id);
                }
            return res;
        }
        
        //## statechart_method 
        public int state_9_dispatchEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(state_9_active == CheckForMalfunction)
                {
                    res = CheckForMalfunction_takeEvent(id);
                }
            return res;
        }
        
        //## statechart_method 
        public int state_2_dispatchEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(state_2_active == AwaitBreakdown)
                {
                    res = AwaitBreakdown_takeEvent(id);
                }
            return res;
        }
        
        //## statechart_method 
        public int state_10_dispatchEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            switch (state_10_active) {
                case AwaitTemperatureChanges:
                {
                    res = AwaitTemperatureChanges_takeEvent(id);
                }
                break;
                case sendaction_12:
                {
                    res = sendaction_12_takeEvent(id);
                }
                break;
                default:
                    break;
            }
            return res;
        }
        
        //## statechart_method 
        public int state_1_dispatchEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(state_1_active == AwaitNewProbes)
                {
                    res = AwaitNewProbes_takeEvent(id);
                }
            return res;
        }
        
        //## auto_generated 
        protected void initStatechart() {
            rootState_subState = RiJNonState;
            rootState_active = RiJNonState;
            state_9_subState = RiJNonState;
            state_9_active = RiJNonState;
            state_2_subState = RiJNonState;
            state_2_active = RiJNonState;
            state_10_subState = RiJNonState;
            state_10_active = RiJNonState;
            state_1_subState = RiJNonState;
            state_1_active = RiJNonState;
        }
        
        //## statechart_method 
        public int AwaitNewProbes_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(event.isTypeOf(ProbeSYN.ProbeSYN_Default_id))
                {
                    res = AwaitNewProbesTakeProbeSYN();
                }
            
            if(res == RiJStateReactive.TAKE_EVENT_NOT_CONSUMED)
                {
                    res = state_1_takeEvent(id);
                }
            return res;
        }
        
        //## statechart_method 
        public int AwaitNewProbesTakeProbeSYN() {
            ProbeSYN params = (ProbeSYN) event;
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            AwaitNewProbes_exit();
            //#[ transition 3 
            params.probe.gen(new ProbeSYNACK());
            //#]
            AwaitNewProbes_entDef();
            res = RiJStateReactive.TAKE_EVENT_COMPLETE;
            return res;
        }
        
        //## statechart_method 
        public int AwaitTemperatureChanges_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(event.isTypeOf(ProbeTemperatureChanged.ProbeTemperatureChanged_Default_id))
                {
                    res = AwaitTemperatureChangesTakeProbeTemperatureChanged();
                }
            
            if(res == RiJStateReactive.TAKE_EVENT_NOT_CONSUMED)
                {
                    res = state_10_takeEvent(id);
                }
            return res;
        }
        
        //## statechart_method 
        public void AwaitTemperatureChanges_exit() {
            AwaitTemperatureChangesExit();
        }
        
        //## statechart_method 
        public void state_10_entDef() {
            state_10_enter();
            state_10EntDef();
        }
        
        //## statechart_method 
        public void AwaitBreakdownEnter() {
        }
        
        //## statechart_method 
        public void state_2Enter() {
        }
        
        //## statechart_method 
        public void terminationstate_16_exit() {
            terminationstate_16Exit();
        }
        
        //## statechart_method 
        public void AwaitNewProbes_entDef() {
            AwaitNewProbes_enter();
        }
        
        //## statechart_method 
        public void state_1Enter() {
        }
        
        //## statechart_method 
        public void sendaction_12Enter() {
            //#[ state Workflow.state_10.sendaction_12.(Entry) 
            gen(new Default.TMAvgTemp(avgTemp));
            //#]
        }
        
        //## statechart_method 
        public void state_10_enter() {
            state_10Enter();
        }
        
        //## statechart_method 
        public void state_9_enter() {
            state_9Enter();
        }
        
        //## statechart_method 
        public void sendaction_4Exit() {
        }
        
        //## statechart_method 
        public void AwaitNewProbes_exit() {
            AwaitNewProbesExit();
        }
        
        //## statechart_method 
        public void terminationstate_14_exit() {
            terminationstate_14Exit();
        }
        
        //## statechart_method 
        public void CheckForMalfunction_entDef() {
            CheckForMalfunction_enter();
        }
        
        //## statechart_method 
        public void state_9_entDef() {
            state_9_enter();
            state_9EntDef();
        }
        
        //## statechart_method 
        public void AwaitBreakdown_exit() {
            AwaitBreakdownExit();
        }
        
        //## statechart_method 
        public void state_2_exit() {
            switch (state_2_subState) {
                case AwaitBreakdown:
                {
                    AwaitBreakdown_exit();
                }
                break;
                case terminationstate_14:
                {
                    terminationstate_14_exit();
                }
                break;
                default:
                    break;
            }
            state_2_subState = RiJNonState;
            state_2Exit();
        }
        
        //## statechart_method 
        public int state_9_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            return res;
        }
        
        //## statechart_method 
        public void state_1_exit() {
            if(state_1_subState == AwaitNewProbes)
                {
                    AwaitNewProbes_exit();
                }
            state_1_subState = RiJNonState;
            state_1Exit();
        }
        
        //## statechart_method 
        public void state_1_entDef() {
            state_1_enter();
            state_1EntDef();
        }
        
        //## statechart_method 
        public int AwaitTemperatureChangesTakeProbeTemperatureChanged() {
            ProbeTemperatureChanged params = (ProbeTemperatureChanged) event;
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            AwaitTemperatureChanges_exit();
            //#[ transition 9 
            temperatures.put(params.probe, params.temperature);
            avgTemp = 0.0;
            for(Double temp : temperatures.values()){
            	avgTemp += temp;
            }
            avgTemp = avgTemp / temperatures.size();
            //#]
            sendaction_12_entDef();
            res = RiJStateReactive.TAKE_EVENT_COMPLETE;
            return res;
        }
        
        //## statechart_method 
        public void sendaction_12_exit() {
            popNullConfig();
            sendaction_12Exit();
        }
        
        //## statechart_method 
        public void state_10EntDef() {
            AwaitTemperatureChanges_entDef();
        }
        
        //## statechart_method 
        public void CheckForMalfunctionEnter() {
        }
        
        //## statechart_method 
        public void state_9EntDef() {
            CheckForMalfunction_entDef();
        }
        
        //## statechart_method 
        public void WorkflowExit() {
        }
        
        //## statechart_method 
        public void AwaitNewProbes_enter() {
            state_1_subState = AwaitNewProbes;
            state_1_active = AwaitNewProbes;
            AwaitNewProbesEnter();
        }
        
        //## statechart_method 
        public void AwaitTemperatureChangesExit() {
        }
        
        //## statechart_method 
        public int sendaction_12_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(event.isTypeOf(RiJEvent.NULL_EVENT_ID))
                {
                    res = sendaction_12TakeNull();
                }
            
            if(res == RiJStateReactive.TAKE_EVENT_NOT_CONSUMED)
                {
                    res = state_10_takeEvent(id);
                }
            return res;
        }
        
        //## statechart_method 
        public void sendaction_12Exit() {
        }
        
        //## statechart_method 
        public void sendaction_12_enter() {
            pushNullConfig();
            state_10_subState = sendaction_12;
            state_10_active = sendaction_12;
            sendaction_12Enter();
        }
        
        //## statechart_method 
        public void state_10Exit() {
        }
        
        //## statechart_method 
        public int terminationstate_14_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            res = state_2_takeEvent(id);
            return res;
        }
        
        //## statechart_method 
        public int rootState_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            return res;
        }
        
        //## statechart_method 
        public void sendaction_4_enter() {
            rootState_subState = sendaction_4;
            rootState_active = sendaction_4;
            sendaction_4Enter();
        }
        
        //## statechart_method 
        public void CheckForMalfunction_exit() {
            popNullConfig();
            CheckForMalfunctionExit();
        }
        
        //## statechart_method 
        public void Workflow_entDef() {
            Workflow_enter();
            state_1_entDef();
            state_2_entDef();
            state_9_entDef();
            state_10_entDef();
        }
        
        //## statechart_method 
        public int sendaction_4_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(event.isTypeOf(TMSYNACK.TMSYNACK_Default_id))
                {
                    res = sendaction_4TakeTMSYNACK();
                }
            
            return res;
        }
        
        //## statechart_method 
        public void state_1Exit() {
        }
        
        //## statechart_method 
        public void sendaction_12_entDef() {
            sendaction_12_enter();
        }
        
        //## statechart_method 
        public void AwaitBreakdown_enter() {
            state_2_subState = AwaitBreakdown;
            state_2_active = AwaitBreakdown;
            AwaitBreakdownEnter();
        }
        
        //## statechart_method 
        public void AwaitBreakdown_entDef() {
            AwaitBreakdown_enter();
        }
        
        //## statechart_method 
        public void terminationstate_14Exit() {
        }
        
        //## statechart_method 
        public void terminationstate_14_enter() {
            state_2_subState = terminationstate_14;
            state_2_active = terminationstate_14;
            terminationstate_14Enter();
        }
        
        //## statechart_method 
        public int state_2_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            return res;
        }
        
        //## statechart_method 
        public void WorkflowEnter() {
        }
        
        //## statechart_method 
        public void rootState_enter() {
            rootStateEnter();
        }
        
        //## statechart_method 
        public void rootStateEnter() {
        }
        
        //## statechart_method 
        public int sendaction_12TakeNull() {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            sendaction_12_exit();
            AwaitTemperatureChanges_entDef();
            res = RiJStateReactive.TAKE_EVENT_COMPLETE;
            return res;
        }
        
        //## statechart_method 
        public void state_2Exit() {
        }
        
        //## statechart_method 
        public void state_9Enter() {
        }
        
        //## statechart_method 
        public void sendaction_4_entDef() {
            sendaction_4_enter();
        }
        
        //## statechart_method 
        public void state_10Enter() {
        }
        
        //## statechart_method 
        public void state_2_entDef() {
            state_2_enter();
            state_2EntDef();
        }
        
        //## statechart_method 
        public void terminationstate_16Exit() {
        }
        
        //## statechart_method 
        public void terminationstate_16_enter() {
            state_9_subState = terminationstate_16;
            state_9_active = terminationstate_16;
            terminationstate_16Enter();
        }
        
        //## statechart_method 
        public void terminationstate_16_entDef() {
            terminationstate_16_enter();
        }
        
        //## statechart_method 
        public void Workflow_enter() {
            rootState_subState = Workflow;
            rootState_active = Workflow;
            WorkflowEnter();
        }
        
        //## statechart_method 
        public int sendaction_4TakeTMSYNACK() {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            sendaction_4_exit();
            Workflow_entDef();
            res = RiJStateReactive.TAKE_EVENT_COMPLETE;
            return res;
        }
        
        //## statechart_method 
        public void AwaitNewProbesExit() {
        }
        
        //## statechart_method 
        public void Workflow_exit() {
            state_1_exit();
            state_2_exit();
            state_9_exit();
            state_10_exit();
            WorkflowExit();
        }
        
        //## statechart_method 
        public void rootStateEntDef() {
            sendaction_4_entDef();
        }
        
        //## statechart_method 
        public void state_1_enter() {
            state_1Enter();
        }
        
        //## statechart_method 
        public int CheckForMalfunction_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(event.isTypeOf(RiJEvent.NULL_EVENT_ID))
                {
                    res = CheckForMalfunctionTakeNull();
                }
            
            if(res == RiJStateReactive.TAKE_EVENT_NOT_CONSUMED)
                {
                    res = state_9_takeEvent(id);
                }
            return res;
        }
        
        //## statechart_method 
        public void CheckForMalfunctionExit() {
        }
        
        //## statechart_method 
        public void CheckForMalfunction_enter() {
            pushNullConfig();
            state_9_subState = CheckForMalfunction;
            state_9_active = CheckForMalfunction;
            CheckForMalfunctionEnter();
        }
        
        //## statechart_method 
        public int terminationstate_16_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            res = state_9_takeEvent(id);
            return res;
        }
        
        //## statechart_method 
        public void state_9_exit() {
            switch (state_9_subState) {
                case CheckForMalfunction:
                {
                    CheckForMalfunction_exit();
                }
                break;
                case terminationstate_16:
                {
                    terminationstate_16_exit();
                }
                break;
                default:
                    break;
            }
            state_9_subState = RiJNonState;
            state_9Exit();
        }
        
        //## statechart_method 
        public void sendaction_4Enter() {
            //#[ state sendaction_4.(Entry) 
            parent.gen(new Default.TMSYN());
            //#]
        }
        
        //## statechart_method 
        public int state_1_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            return res;
        }
        
        //## statechart_method 
        public void AwaitTemperatureChanges_enter() {
            state_10_subState = AwaitTemperatureChanges;
            state_10_active = AwaitTemperatureChanges;
            AwaitTemperatureChangesEnter();
        }
        
        //## statechart_method 
        public int state_10_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            return res;
        }
        
        //## statechart_method 
        public void state_10_exit() {
            switch (state_10_subState) {
                case AwaitTemperatureChanges:
                {
                    AwaitTemperatureChanges_exit();
                }
                break;
                case sendaction_12:
                {
                    sendaction_12_exit();
                }
                break;
                default:
                    break;
            }
            state_10_subState = RiJNonState;
            state_10Exit();
        }
        
        //## statechart_method 
        public void AwaitBreakdownExit() {
        }
        
        //## statechart_method 
        public void state_2_enter() {
            state_2Enter();
        }
        
        //## statechart_method 
        public int CheckForMalfunctionTakeNull() {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            //## transition 13 
            if(!isBroken)
                {
                    CheckForMalfunction_exit();
                    CheckForMalfunction_entDef();
                    res = RiJStateReactive.TAKE_EVENT_COMPLETE;
                }
            else
                {
                    //## transition 14 
                    if(isBroken)
                        {
                            CheckForMalfunction_exit();
                            //#[ transition 14 
                            parent.gen(new TemperatureMeasurerBroken());
                            //#]
                            terminationstate_16_entDef();
                            res = RiJStateReactive.TAKE_EVENT_COMPLETE;
                        }
                }
            return res;
        }
        
        //## statechart_method 
        public int Workflow_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            return res;
        }
        
        //## statechart_method 
        public void AwaitTemperatureChangesEnter() {
        }
        
        //## statechart_method 
        public void AwaitTemperatureChanges_entDef() {
            AwaitTemperatureChanges_enter();
        }
        
        //## statechart_method 
        public int AwaitBreakdown_takeEvent(short id) {
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            if(event.isTypeOf(ProbeBroken.ProbeBroken_Default_id))
                {
                    res = AwaitBreakdownTakeProbeBroken();
                }
            
            if(res == RiJStateReactive.TAKE_EVENT_NOT_CONSUMED)
                {
                    res = state_2_takeEvent(id);
                }
            return res;
        }
        
        //## statechart_method 
        public void terminationstate_16Enter() {
        }
        
        //## statechart_method 
        public void rootStateExit() {
        }
        
        //## statechart_method 
        public void state_1EntDef() {
            AwaitNewProbes_entDef();
        }
        
        //## statechart_method 
        public int AwaitBreakdownTakeProbeBroken() {
            ProbeBroken params = (ProbeBroken) event;
            int res = RiJStateReactive.TAKE_EVENT_NOT_CONSUMED;
            //## transition 6 
            if(!itsProbe.isEmpty())
                {
                    AwaitBreakdown_exit();
                    //#[ transition 5 
                    System.out.println("MALFUNCTION: Probe " + params.probe.toString() + " broken");
                    itsProbe.remove(params.probe);
                    temperatures.remove(params.probe);
                    //#]
                    AwaitBreakdown_entDef();
                    res = RiJStateReactive.TAKE_EVENT_COMPLETE;
                }
            else
                {
                    //## transition 7 
                    if(itsProbe.isEmpty())
                        {
                            AwaitBreakdown_exit();
                            //#[ transition 5 
                            System.out.println("MALFUNCTION: Probe " + params.probe.toString() + " broken");
                            itsProbe.remove(params.probe);
                            temperatures.remove(params.probe);
                            //#]
                            //#[ transition 7 
                            
                            System.out.println("MALFUNCTION: All probes are broken!");
                            parent.gen(new TemperatureMeasurerBroken());
                            //#]
                            terminationstate_14_entDef();
                            res = RiJStateReactive.TAKE_EVENT_COMPLETE;
                        }
                }
            return res;
        }
        
        //## statechart_method 
        public void terminationstate_14_entDef() {
            terminationstate_14_enter();
        }
        
        //## statechart_method 
        public void sendaction_4_exit() {
            sendaction_4Exit();
        }
        
        //## statechart_method 
        public void AwaitNewProbesEnter() {
        }
        
        //## statechart_method 
        public void terminationstate_14Enter() {
        }
        
        //## statechart_method 
        public void state_2EntDef() {
            AwaitBreakdown_entDef();
        }
        
        //## statechart_method 
        public void state_9Exit() {
        }
        
    }
}
/*********************************************************************
	File Path	: DefaultComponent/DefaultConfig/Default/TemperatureMeasurer.java
*********************************************************************/

